package com.example.ping.mq;


import org.apache.rocketmq.spring.core.RocketMQTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
 * @author Jim
 * @create 2025/1/13
 */

@Component
public class LogProducer {

    @Autowired
    private RocketMQTemplate rocketMQTemplate;

    private static final String LOG_TOPIC = "log-topic";  // 日志消息的主题

    public void sendLog(String logMessage) {
        // 发送日志消息到 RocketMQ
        rocketMQTemplate.convertAndSend(LOG_TOPIC, logMessage);
    }
}
